#ifndef ALTABSTRACTMAPEDITOR_H
#define ALTABSTRACTMAPEDITOR_H

#include <QMainWindow>

class QAction;
class QMenu;

namespace Alt {
     class Map;

     /*! Base class for map editor widgets. The file currently being edited can be retrieved with QWidget::windowFilePath(). */
     class AbstractMapEditor : public QMainWindow {
          Q_OBJECT
     public:
          /*! Default constructor.
              \param parent The parent object. */
          AbstractMapEditor(QWidget* parent = 0);

          /*! Destructor. */
          virtual ~AbstractMapEditor();

          /*! Default file extension for the map being edited.
               The returned string should be in the format: File type (*.fileExtension). For example: "Tiled map files (*.atm).
               If the format is not adhered to, the map editor may function improperly, or even crash. */
          virtual QString defaultFileFilter() const = 0;

          /*! The map currently being edited. */
          virtual Map* map() const = 0;

     private slots:
          /*! Triggered by File->New action. Creates a new map using the chosen map editor plugin.
               \param action The action that triggered this slot. */
          void fileNew(QAction* action);

          /*! Triggered by File->Open action. Creates a file dialog to open an existing map file. */
          void fileOpen();

          /*! Triggered by File->Save action. Saves the current map. */
          void fileSave();

          /*! Triggered by File->Save as action. Saves the current map under a new name. */
          void fileSaveAs();

     protected:
          /*! File menu already containing the New, Open, Save, Save as, and Close items. */
          QMenu* m_fileMenu;

          /*! File->New action. */
          QMenu* m_fileNewMenu;

          /*! File->Open action. */
          QAction* m_fileOpenAction;

          /*! File->Save action. */
          QAction* m_fileSaveAction;

          /*! File->Save as action. */
          QAction* m_fileSaveAsAction;

          /*! File->Close action. */
          QAction* m_fileCloseAction;
     };
}

#endif
